* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.mobile-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* 连接状态面板 */
.connection-panel {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-top: 20vh;
}

.connection-panel h1 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

.connection-panel h2 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
}

.error-message {
    color: #e74c3c;
    font-size: 1.1rem;
    line-height: 1.6;
}

.connection-info {
    color: #2c3e50;
    font-size: 1.1rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 游戏头部 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.game-header h2 {
    font-size: 1.5rem;
    color: #2c3e50;
    font-weight: 600;
}

.disconnect-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.disconnect-btn:hover {
    background: #c0392b;
}

/* 顶部工具栏 */
.top-toolbar {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    justify-content: center;
}

.tool-btn {
    width: 50px;
    height: 50px;
    border: 2px solid #ddd;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.tool-btn:hover {
    border-color: #3498db;
    transform: scale(1.1);
}

.tool-btn.active {
    border-color: #3498db;
    background: #3498db;
    color: white;
}

.clear-btn {
    background: #ff4757;
    color: white;
}

.clear-btn:hover {
    background: #ff3742;
}

.color-picker-btn, .emoji-picker-btn {
    background: #ff9ff3;
    color: white;
}

.color-picker-btn:hover, .emoji-picker-btn:hover {
    background: #fd79a8;
}

.brush-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brush-slider {
    width: 80px;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    border-radius: 4px;
    outline: none;
}

.brush-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
}

.brush-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: none;
}

/* 颜色选择器 */
.color-picker-dropdown, .emoji-picker-dropdown {
    position: relative;
}

.color-picker-menu, .emoji-picker-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
    flex-wrap: wrap;
    gap: 5px;
    max-width: 200px;
}

.color-picker-menu.show, .emoji-picker-menu.show {
    display: flex;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s ease;
}

.color-option:hover {
    transform: scale(1.2);
}

.color-option.active {
    border-color: #000;
    transform: scale(1.1);
}

/* 表情选择器 */
.emoji-picker-menu {
    width: 250px;
    max-height: 300px;
    overflow-y: auto;
}

.emoji-categories {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.category-btn {
    padding: 5px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.2rem;
    border-radius: 5px;
    transition: background 0.2s ease;
}

.category-btn:hover {
    background: #f1f2f6;
}

.category-btn.active {
    background: #3498db;
    color: white;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.emoji-option {
    font-size: 1.5rem;
    cursor: pointer;
    text-align: center;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.2s ease;
}

.emoji-option:hover {
    background: #f1f2f6;
}

/* 画布区域 */
.canvas-wrapper {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.drawing-canvas {
    background: white;
    border: 2px solid #ddd;
    border-radius: 10px;
    touch-action: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 底部题目显示 */
.word-display {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.word-display h3 {
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
}

.waiting-text {
    color: #7f8c8d;
    font-style: italic;
}

.has-word {
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .mobile-container {
        padding: 10px;
    }
    
    .game-header {
        padding: 10px 15px;
    }
    
    .game-header h2 {
        font-size: 1.3rem;
    }
    
    .top-toolbar {
        padding: 10px;
        gap: 8px;
    }
    
    .tool-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .canvas-wrapper {
        padding: 15px;
    }
    
    .word-display {
        padding: 15px;
    }
    
    .word-display h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .connection-panel h1 {
        font-size: 1.5rem;
    }
    
    .connection-panel h2 {
        font-size: 1.2rem;
    }
    
    .tool-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .brush-slider {
        width: 60px;
    }
    
    .color-picker-menu, .emoji-picker-menu {
        max-width: 180px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}